﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Bes.Swsp.ToolBox
{
  /// <summary>
  /// A class representing an outlet node in the storm drainage network.
  /// </summary>
  public class OutletNode : TransitionNode
  {
    public OutletNode()
      : base()
    {
    }

    public OutletNode(int id)
      : base(id)
    {
    }

    public override NodeType Type
    {
      get
      {
        return NodeType.Outlet;
      }
    }

    /// <summary>
    /// The overland flow path of water draining out of this outlet.
    /// </summary>
    public FlowLine OutletFlowPath
    {
      get
      {
        return this.DownstreamConveyance as FlowLine;
      }

      set
      {
        this.DownstreamConveyance = value;
      }
    }

    /// <summary>
    /// The catchment that receives flow from this outlet
    /// </summary>
    public Catchment ReceivingCatchment
    {
      get
      {
        InletNode downstreamInlet = this.DownstreamTransition as InletNode;
        if (downstreamInlet != null)
        {
          return downstreamInlet.CatchmentArea;
        }
        else
        {
          return null;
        }
      }
    }

    public override string ToString()
    {
      return string.Format("Outlet {0}", this.ID);
    }
  }
}
